package com.xhg.mqtt;


import java.util.ArrayList;
import java.util.List;

/**
 * @Description 
 * @author E.T
 * @date 2018-08-28 10:14
 * @updateby
 * @updatedate
 * @version 1.0
 * @since 1.0
 */
public class newpb {
        public byte[] tobyte(){
            System.out.println("===== 构建一个模型开始 =====");
            List<Integer> errorCodes = new ArrayList<>();
            errorCodes.add(102);
            errorCodes.add(11);
            errorCodes.add(213);
            BoxInfoPb.BoxStatus.Builder boxStatus = BoxInfoPb.BoxStatus.newBuilder();
            boxStatus.setBoxStatus(1);
            boxStatus.setExceptStatus(1);
            boxStatus.setLoadRate(0.78);
            boxStatus.setSterilizeStatus(0);
            boxStatus.addAllErrorCode(errorCodes);
            boxStatus.setAdd(100);
            BoxInfoPb.BoxInfo.Builder boxInfo = BoxInfoPb.BoxInfo.newBuilder();
            boxInfo.addBoxStatus(boxStatus);
            BoxInfoPb.BoxInfo bo = boxInfo.build();
            return bo.toByteArray();
        }
    public byte[] online(){
        OnlineStatusPb.OnlineStatus.Builder online = OnlineStatusPb.OnlineStatus.newBuilder();
        online.setStatus(1);
        online.setStatusDesc("ceshi");
        online.setAdd(123);
        return online.build().toByteArray();
    }
}
